home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2005 October
/
PCWOCT05.iso
/
Software
/
FromTheMag
/
Ant Movie Catalog 3.5.0.2
/
amc_install.exe
/
{app}
/
Scripts
/
film.pl.ifs
< prev
next >
Wrap
Text File
|
2005-03-13
|
28KB
|
707 lines
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Goster
Title=film.pl
Description=film.pl info & picture
Site=http://film.pl/
Language=PL
Version=
Requires=3.5.0
Comments= Movie information & picture importation
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
GetInfo=1
[Options]
***************************************************)
program FilmPL;
var
MovieName, fid: string;
Link: string;
pozycja, pozycja2, pozycja3: integer;
cover, nocover: boolean;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(Pattern, List.GetString(i)) <> 0 then
begin
result := i;
Break;
end;
end;
procedure DecodeHTML(var Value: String);
var
FullValue, CharCode: String;
Counter: Integer;
begin
if Value <> '' then begin
FullValue := '';
Counter := 1;
repeat
if StrGet(Value, Counter) <> '&' then
begin
CharCode := copy(Value, Counter, 1);
case CharCode of
'▒': CharCode := '╣';
'╢': CharCode := '£';
'í': CharCode := 'Ñ';
'╝': CharCode := 'ƒ';
'ª': CharCode := 'î';
'¼': CharCode := 'Å';
end;
FullValue := FullValue + CharCode;
Counter := Counter + 1;
end
else
begin
CharCode := copy(Value, Counter, 7);
case CharCode of
'ą': FullValue := FullValue + '╣';
'ć': FullValue := FullValue + 'µ';
'ę': FullValue := FullValue + 'Ω';
'ł': FullValue := FullValue + '│';
'ń': FullValue := FullValue + '±';
'ó': FullValue := FullValue + '≤';
'ś': FullValue := FullValue + '£';
'ź': FullValue := FullValue + 'ƒ';
'ż': FullValue := FullValue + '┐';
'Ą': FullValue := FullValue + 'Ñ';
'Ć': FullValue := FullValue + '╞';
'Ę': FullValue := FullValue + '╩';
'Ł': FullValue := FullValue + 'ú';
'Ń': FullValue := FullValue + '╤';
'Ó': FullValue := FullValue + '╙';
'Ś': FullValue := FullValue + 'î';
'Ź': FullValue := FullValue + 'Å';
'Ż': FullValue := FullValue + '»';
'Š': FullValue := FullValue + ' ';
'š': FullValue := FullValue + 'í';
'Ţ': FullValue := FullValue + 'í';
'ţ': FullValue := FullValue + 'ú';
'Ť': FullValue := FullValue + 'ñ';
'ť': FullValue := FullValue + 'Ñ';
'Ŧ': FullValue := FullValue + 'î';
'ŧ': FullValue := FullValue + 'º';
'Ũ': FullValue := FullValue + '¿';
'ũ': FullValue := FullValue + '⌐';
'Ű': FullValue := FullValue + '¬';
'ű': FullValue := FullValue + '½';
'Ų': FullValue := FullValue + '¼';
'ų': FullValue := FullValue + '¡';
'Ŵ': FullValue := FullValue + '«';
'ŵ': FullValue := FullValue + '»';
'Ŷ': FullValue := FullValue + '░';
'ŷ': FullValue := FullValue + '▒';
'Ÿ': FullValue := FullValue + '▓';
'ƀ': FullValue := FullValue + '┤';
'Ɓ': FullValue := FullValue + '╡';
'Ƃ': FullValue := FullValue + '╢';
'ƃ': FullValue := FullValue + '╖';
'Ƅ': FullValue := FullValue + '╕';
'ƅ': FullValue := FullValue + '╣';
'Ɔ': FullValue := FullValue + '║';
'Ƈ': FullValue := FullValue + '╗';
'ƈ': FullValue := FullValue + '╝';
'Ɖ': FullValue := FullValue + '╜';
'Ɛ': FullValue := FullValue + '╛';
'Ƒ': FullValue := FullValue + '┐';
'ƒ': FullValue := FullValue + '└';
'Ɠ': FullValue := FullValue + '┴';
'Ɣ': FullValue := FullValue + '┬';
'ƕ': FullValue := FullValue + '├';
'Ɩ': FullValue := FullValue + '─';
'Ɨ': FullValue := FullValue + '┼';
'Ƙ': FullValue := FullValue + '╞';
'ƙ': FullValue := FullValue + '╟';
'Ȁ': FullValue := FullValue + '╚';
'ȁ': FullValue := FullValue + '╔';
'Ȃ': FullValue := FullValue + '╩';
'ȃ': FullValue := FullValue + '╦';
'Ȅ': FullValue := FullValue + '╠';
'ȅ': FullValue := FullValue + '═';
'Ȇ': FullValue := FullValue + '╬';
'ȇ': FullValue := FullValue + '╧';
'Ȉ': FullValue := FullValue + '╨';
'ȉ': FullValue := FullValue + '╤';
'Ȑ': FullValue := FullValue + '╥';
'ȑ': FullValue := FullValue + '╙';
'Ȓ': FullValue := FullValue + '╘';
'ȓ': FullValue := FullValue + '╒';
'Ȕ': FullValue := FullValue + '╓';
'ȕ': FullValue := FullValue + '╫';
'Ȗ': FullValue := FullValue + '╪';
'ȗ': FullValue := FullValue + '┘';
'Ș': FullValue := FullValue + '┌';
'ș': FullValue := FullValue + '█';
'Ƞ': FullValue := FullValue + '▄';
'ȡ': FullValue := FullValue + '▌';
'Ȣ': FullValue := FullValue + '▐';
'ȣ': FullValue := FullValue + '▀';
'Ȥ': FullValue := FullValue + 'α';
'ȥ': FullValue := FullValue + 'ß';
'Ȧ': FullValue := FullValue + 'Γ';
'ȧ': FullValue := FullValue + 'π';
'Ȩ': FullValue := FullValue + 'Σ';
'ȩ': FullValue := FullValue + 'σ';
'Ȱ': FullValue := FullValue + 'µ';
'ȱ': FullValue := FullValue + 'τ';
'Ȳ': FullValue := FullValue + 'Φ';
'ȳ': FullValue := FullValue + 'Θ';
'ȴ': FullValue := FullValue + 'Ω';
'ȵ': FullValue := FullValue + 'δ';
'ȶ': FullValue := FullValue + '∞';
'ȷ': FullValue := FullValue + 'φ';
'ȸ': FullValue := FullValue + 'ε';
'ȹ': FullValue := FullValue + '∩';
'ɀ': FullValue := FullValue + '≡';
'Ɂ': FullValue := FullValue + '±';
'ɂ': FullValue := FullValue + '≥';
'Ƀ': FullValue := FullValue + '≤';
'Ʉ': FullValue := FullValue + '⌠';
'Ʌ': FullValue := FullValue + '⌡';
'Ɇ': FullValue := FullValue + '÷';
'ɇ': FullValue := FullValue + '≈';
'Ɉ': FullValue := FullValue + '°';
'ɉ': FullValue := FullValue + '∙';
'ɐ': FullValue := FullValue + '·';
'ɑ': FullValue := FullValue + '√';
'ɒ': FullValue := FullValue + 'ⁿ';
'ɓ': FullValue := FullValue + '²';
'ɔ': FullValue := FullValue + '■';
'ɕ': FullValue := FullValue + ' ';
'%DF;': FullValue := FullValue + '▀';
'4': FullValue := FullValue + '"';
'–': FullValue := FullValue + '-';
'‘': FullValue := FullValue + '"';
'’': FullValue := FullValue + '"';
'“': FullValue := FullValue + '"';
'”': FullValue := FullValue + '"';
'„': FullValue := FullValue + '"';
else
FullValue := FullValue + CharCode;
end;
Counter := Counter + 7;
end;
until Counter > Length(Value);
HTMLDecode(FullValue);
Value := FullValue;
end
end;
procedure AnalyzePage();
var
Page: TStringList;
pozycja, startPos, endPos: integer;
linia, adres, tytul: string;
begin
Page := TStringList.Create;
PickTreeClear;
link := URLEncode('http://film.pl/modules.php?op=reviews&name=FilmPl_Recenzje&litera=' + MovieName);
Page.Text := GetPage(link);
pozycja := FindLine('0 recenzji', Page, 0);
if pozycja > 0 then
begin
DecodeHTML(MovieName);
ShowMessage('Nie znaleziono ┐adnego filmu spe│niaj╣cego kryteria: "'+MovieName+'".');
end
else
begin;
pozycja := FindLine('recenzji', Page, 0);
repeat
begin
pozycja := FindLine('<a href="modules.php?name=FilmPl_Recenzje&rop=showcontent&id=', Page, pozycja + 1);
if (pozycja > -1) then
begin
linia := Page.GetString(pozycja);
startPos := pos('id=', Linia);
endPos := pos('">', Linia);
link := 'http://film.pl/modules.php?name=FilmPl_Recenzje&rop=showcontent&id=' + copy(linia, startPos + 3, endPos - startPos -3);
adres := URLEncode(link);
linia := Page.GetString(pozycja + 1);
linia := copy(linia, pos('» ', linia) + 6, length(linia));
HTMLRemoveTags(linia);
DecodeHTML(linia);
tytul := linia;
linia := Page.GetString(pozycja + 2);
HTMLRemoveTags(linia);
DecodeHTML(linia);
tytul := tytul +' ' + linia;
linia := Page.GetString(pozycja + 3);
HTMLRemoveTags(linia);
DecodeHTML(linia);
tytul := tytul +' ' + linia;
linia := Page.GetString(pozycja + 4);
HTMLRemoveTags(linia);
DecodeHTML(linia);
tytul := tytul +' ' + linia;
linia := Page.GetString(pozycja + 5);
HTMLRemoveTags(linia);
DecodeHTML(linia);
tytul := tytul +' ' + linia;
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
PickTreeAdd(tytul, adres);
end;
end;
until (pozycja = -1);
end;
if PickTreeExec(adres) then
begin
Page.Text := GetPage(adres);
link := adres;
AnalyzeMoviePage(page);
end;
Page.Free;
end;
procedure AnalyzeMoviePage(Page: TStringList);
var
Linia, tytul, line, Obsada, OrgLine, adres: string;
LineNr, licznik: Integer;
StartPos, EndPos, i: Integer;
begin
if cover = false then
begin
//recenzja i ocena
pozycja := FindLine('Ocena filmu:', Page, 0);
linia := Page.GetString(pozycja);
startPos := pos('alt="', linia);
if startPos > 0 then
begin
delete(linia, 1, startPos + 4);
endPos := pos('">', linia);
tytul := copy(linia, 1, endPos - 1);
setField(fieldRating, tytul);
end;
pozycja := pozycja + 1;
tytul := '';
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
DecodeHTML(linia);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
pozycja2 := FindLine('rednia ocena recenzji', Page, 0);
repeat
begin
linia := Page.GetString(pozycja);
if linia <> '' then
begin
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
end;
if (linia = '') then
begin
pozycja := pozycja + 1;
linia := Page.GetString(pozycja);
end;
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
tytul := tytul + ' ' + linia;
pozycja := pozycja + 1;
end;
until (pozycja >= pozycja2);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
if (tytul <> '') then setField(fieldComments, tytul);
//pobranie strony z opisem
pozycja := FindLine('>Opis<', Page, 0);
linia := Page.GetString(pozycja);
startPos := pos('fid=', linia);
delete(linia, 1, startPos + 3);
endPos := pos('">Opis', linia);
fid := copy(linia, 1, endPos - 1);
link := URLEncode('http://film.pl/modules.php?name=AboutFilm&file=credits&fid=' + fid);
Page.Text := GetPage(link);
// Tytu│ polski i oryginalny
pozycja := FindLine('<!-- menu gorne -->', Page, 0);
pozycja := FindLine('<!-- menu gorne -->', Page, pozycja + 1);
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
setField(fieldDescription, linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
startPos := pos('(', linia);
endPos := pos(')', linia);
if ((startPos = 0) and (endPos = 0)) then
begin
tytul := copy(linia, 1, length(linia));
if pos(', The ', tytul) > 0 then tytul := StringReplace(tytul, ', The', '');
if pos('The ', tytul) > 0 then tytul := StringReplace(tytul, 'The', '');
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
setField(fieldTranslatedTitle, tytul);
setField(fieldOriginalTitle, tytul);
end
else
begin
tytul := copy(linia, 1, startPos - 1);
if pos(', The ', tytul) > 0 then tytul := StringReplace(tytul, ', The', '');
if pos('The ', tytul) > 0 then tytul := StringReplace(tytul, 'The', '');
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
setField(fieldTranslatedTitle, tytul);
tytul := copy(linia, startPos + 1, endPos - startPos - 1);
if pos(', The ', tytul) > 0 then tytul := StringReplace(tytul, ', The', '');
if pos('The ', tytul) > 0 then tytul := StringReplace(tytul, 'The', '');
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
setField(fieldOriginalTitle, tytul);
end;
// Opis filmu
tytul := '';
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
pozycja2 := FindLine('Gatunek', Page, 0);
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
tytul := tytul + linia;
pozycja := pozycja + 1;
end;
until (pozycja >= pozycja2);
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
setField(fieldDescription, tytul);
// Gatunek
pozycja := FindLine('Gatunek', Page, 0);
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
setField(fieldCategory, linia);
end;
//Re┐yser
pozycja := FindLine('Re┐yseria', Page, 0);
tytul := '';
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
pozycja2 := FindLine('Scenariusz', Page, 0);
if pozycja2 = -1 then pozycja2 := FindLine('Obsada', Page, 0);
if pozycja2 = -1 then pozycja2 := FindLine('ZdjΩcia', Page, 0);
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
if linia <> '' then
begin
if tytul = '' then tytul := linia
else tytul := tytul + ', ' + linia;
end;
pozycja := pozycja + 1;
end;
until (pozycja >= pozycja2);
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
setField(fieldDirector, tytul);
end;
//Obsada
tytul := '';
pozycja := FindLine('Obsada', Page, 0);
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
pozycja2 := FindLine('ZdjΩcia', Page, 0);
if pozycja2 = -1 then pozycja2 := FindLine('Muzyka', Page, 0);
if pozycja2 = -1 then pozycja2 := FindLine('Scenografia', Page, 0);
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
if linia <> '' then
begin
if tytul = '' then tytul := linia
else tytul := tytul + ', ' + linia;
end;
pozycja := pozycja + 1;
end;
until (pozycja >= pozycja2);
while ((copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
while ((copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = ' ')) do delete(tytul, length(tytul), 1);
if (pos(', wiΩcej :', tytul) > 0) then delete(tytul, pos(', wiΩcej :', tytul), length(tytul) - pos(', wiΩcej :', tytul) + 1);
tytul := StringReplace(tytul, ', jako, ', ' jako ');
setField(fieldActors, tytul);
end;
//Producent i kraj
pozycja := -1;
pozycja := FindLine('Producent', Page, 0);
if pozycja = -1 then pozycja := FindLine('Dystrybutor', Page, 0);
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
startPos := pos('(' , linia);
if startPos >0 then
begin
endPos := pos(')' , linia);
tytul := copy(linia, startPos + 1, endPos - startPos - 1);
delete(linia, startPos, endPos - startPos + 1);
setField(fieldCountry, tytul);
end;
setField(fieldProducer, linia);
end;
// Rok produkcji
pozycja := FindLine('Rok', Page, 0);
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
startPos := pos('(' , linia);
setField(fieldYear, linia);
end;
// Czas trwania
pozycja := -1;
pozycja := FindLine('Czas', Page, 0);
if pozycja > -1 then
begin
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
startPos := pos(' min' , linia);
if startPos >0 then
begin
endPos := pos(' min', linia);
linia := copy(linia, 1, endPos - 1);
end;
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
while ((copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);
setField(FieldLength, linia);
end;
//URL
setField(fieldURL, link);
end; //koniec do bez foto
//Foto
if (nocover = false) then
begin
//pobranie strony z galeri╣
link := URLEncode('http://film.pl/modules.php?name=FilmPl_Galerie&op=galeria&fid=' + fid + '&plakat=1');
Page.Text := GetPage(link);
PickTreeClear;
PickTreeAdd('Wybierz ZdjΩcie','');
licznik := 0;
pozycja := FindLine('Galeria', Page, 0);
pozycja := pozycja + 1;
repeat
begin
linia := Page.GetString(pozycja);
HTMLRemoveTags(linia);
DecodeHTML(linia);
while ((copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
if (linia = '') then pozycja := pozycja +1;
end;
until (linia <> '');
pozycja2 := FindLine('Otwarty Katalog Internetowy', Page, pozycja + 1);
repeat
begin
linia := Page.GetString(pozycja);
startPos := pos(';id=', linia);
endPos := pos('name=FilmPl_Galerie', linia);
if ((startPos <> 0) and (endPos <> 0)) then
begin
delete(linia, 1, startPos + 3);
endPos := pos('&fid=', linia);
tytul := copy(linia, 1, endPos - 1);
licznik := licznik + 1;
adres := 'http://film.pl/modules.php?name=FilmPl_Galerie&op=zdjecie&id=' + tytul + '&fid=' + fid + '&plakat=1';
PickTreeAdd(IntToStr(licznik), adres);
end;
pozycja := pozycja + 1;
end;
until (pozycja >= pozycja2);
if licznik > 1 then
begin
if PickTreeExec(adres) then
Page.text := GetPage(adres);
end;
if licznik = 1 then
Page.Text := GetPage(adres);
pozycja := FindLine('<img src="./images/galeria/', Page, 0);
linia := Page.GetString(pozycja);
startPos := pos('/images/galeria/', linia);
delete(linia, 1, startPos - 1);
endPos := pos('.jpg', linia);
tytul := copy(linia, 1, endPos + 3);
adres := 'http://film.pl/' + tytul;
GetPicture(adres);
end;
//DisplayResults;
end;
begin
if CheckVersion(3,5,0) then
begin
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then MovieName := GetField(fieldOriginalTitle);
if Input('FilmPL Import', 'Podaj tytu│ filmu:', MovieName) then
begin
// Zamiana na ISO-8859-2
MovieName:=StringReplace(MovieName, '╣', chr(177));
MovieName:=StringReplace(MovieName, 'µ', chr(230));
MovieName:=StringReplace(MovieName, 'Ω', chr(234));
MovieName:=StringReplace(MovieName, '│', chr(179));
MovieName:=StringReplace(MovieName, '±', chr(241));
MovieName:=StringReplace(MovieName, '≤', chr(243));
MovieName:=StringReplace(MovieName, '£', chr(182));
MovieName:=StringReplace(MovieName, 'ƒ', chr(188));
MovieName:=StringReplace(MovieName, '┐', chr(191));
MovieName:=StringReplace(MovieName, 'Ñ', chr(161));
MovieName:=StringReplace(MovieName, '╞', chr(198));
MovieName:=StringReplace(MovieName, '╩', chr(202));
MovieName:=StringReplace(MovieName, 'ú', chr(163));
MovieName:=StringReplace(MovieName, '╤', chr(209));
MovieName:=StringReplace(MovieName, '╙', chr(211));
MovieName:=StringReplace(MovieName, 'î', chr(166));
MovieName:=StringReplace(MovieName, 'Å', chr(172));
MovieName:=StringReplace(MovieName, '»', chr(175));
pozycja := pos('/cover/', MovieName);
if pozycja > 0 then
begin
MovieName := StringReplace(MovieName, '/cover/' , '');
cover := true;
end
else cover := false;
pozycja := pos('/nocover/', MovieName);
if pozycja > 0 then
begin
MovieName := StringReplace(MovieName, '/nocover/' , '');
nocover := true;
end
else nocover := false;
while (copy(MovieName, length(MovieName), 1) = ' ') do delete(MovieName, length(MovieName), 1);
while (copy(MovieName, 1, 1) = ' ') do delete(MovieName, 1, 1);
AnalyzePage();
end;
end
else
ShowMessage('Skrypt wymaga programu Ant Movie Catalog w wersji 3.5.0 lub nowszej');
end.